package com.fenghongzhang.yuekao;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import android.Manifest;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioButton;

import com.google.android.material.tabs.TabLayout;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private TabLayout tab;
    private ViewPager mainVp;
    private RadioButton info;
    private RadioButton me;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        tab = (TabLayout) findViewById(R.id.tab);
        mainVp = (ViewPager) findViewById(R.id.main_vp);
        info = (RadioButton) findViewById(R.id.info);
        me = (RadioButton) findViewById(R.id.me);


        List<String> tabList = new ArrayList<>();
        tabList.add("音乐");
        tabList.add("联系人");





        List<Fragment> list  = new ArrayList<>();
        list.add(new MusicFragment());
        list.add(new PersonFragment());

        MainVpAdapter mainVpAdapter = new MainVpAdapter(getSupportFragmentManager(),list,tabList);

        mainVp.setAdapter(mainVpAdapter);

        //绑定
        tab.setupWithViewPager(mainVp);
    }

    public void info(View view) {
    }
}
